﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Zeta;
using Zeta.Common;
using Zeta.CommonBot;
using Zeta.Common.Plugins;
using Zeta.Internals;
using Zeta.Internals.Actors;
using Zeta.Internals.Service;

namespace BossHog.ProfileBuilder
{
    public class MoveToElement : BuddyXmlBase, IOrderChildElement
    {
        public MoveToElement() : base()
        {
            try
            {
                if (null != Zeta.ZetaDia.Me)
                {
                    x = Zeta.ZetaDia.Me.Position.X.ToString();
                    y = Zeta.ZetaDia.Me.Position.Y.ToString();
                    z = Zeta.ZetaDia.Me.Position.Z.ToString();
                }
            }
            catch (Exception ex) {Logging.Write(LogLevel.Verbose, "[BossHog] Error: " + ex.Message); }

            pathPrecision = "10";
            if (string.IsNullOrEmpty(questId) || string.IsNullOrWhiteSpace(questId))
            {
                questId = "1";
            }
        }

        public MoveToElement(Vector3 v)
            : this()
        {
            x = v.X.ToString();
            y = v.Y.ToString();
            z = v.Z.ToString();
        }

        public string pathPrecision { get; set; }
        public string x { get; set; }
        public string y { get; set; }
        public string z { get; set; }

        public override string ToString()
        {
            return string.Format("<MoveTo questId=\"{0}\" x=\"{1}\" y=\"{2}\" z=\"{3}\" pathPrecision=\"{4}\" />", new object[] { questId,x,y,z,pathPrecision});
        }

    }
}
